package Thread_.homework;

public class test12 {
    /**
     * 有三个线程，线程名称分别为：a，b，c。
     * 每个线程打印自己的名称。
     * 需要让他们同时启动，并按 c，b，a的顺序打印
     */
    public static void main(String[] args) throws InterruptedException {
        Thread t3=new Thread(()->{
            System.out.println(Thread.currentThread().getName());
        },"c");
        Thread t2=new Thread(()->{
            try {
                t3.join();//t2执行的时候，让t3先执行，t2进入阻塞状态
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println(Thread.currentThread().getName());
        },"b");
        Thread t1=new Thread(()->{
            try {
                t2.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println(Thread.currentThread().getName());
        },"a");
        t1.start();
        t2.start();
        t3.start();
    }

}